package com.aaa.service.sas.impl;

import com.aaa.dao.sas.QuSasDao;

import com.aaa.entity.sas.PageSortEntity;
import com.aaa.entity.sas.QuestionSas;
import com.aaa.entity.sds.Sds;
import com.aaa.service.sas.QuSasService;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Auther: wanghuajie
 * @Date: 2022/8/29 19:54
 * @Description:
 */
@Service
public class QuSasServiceImpl implements QuSasService {
    @Autowired
    private QuSasDao quSasDao;

    @Override
    public List<QuestionSas> FindAllQuesTionSAS(PageSortEntity pageSortEntity, QuestionSas questionSas) {
        PageHelper.startPage(pageSortEntity.getPage(), pageSortEntity.getLimit(), pageSortEntity.getOrderString());
        List<QuestionSas> quesTions = quSasDao.FindAllQuesTionSAS(questionSas);
        return quesTions;
    }

    @Override
    public int insertSas(QuestionSas questionSas) {
        return quSasDao.insert(questionSas);
    }

    @Override
    public boolean deleteQuesTionSAS(int[] id) {
        int i = quSasDao.deleteQuesTionSAS(id);
        if (i > 0) {
            return true;
        }
        return false;
    }

    @Override
    public int updataQuesTionSAS(QuestionSas questionSas) {
        return quSasDao.updataQuesTionSAS(questionSas);
    }



    @Override
    public List<QuestionSas> findAllSAS() {
        return quSasDao.findAllSAS();
    }

    @Override
    public boolean repetitionNameSas(QuestionSas questionSas) {
        Integer repetitionNameSas = quSasDao.repetitionNameSas(questionSas);
        if (repetitionNameSas==0){
            return true;
        }
        return false;

    }

}
